<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>局部组件</title>
</head>
<body>
  <div id="app">
    {{name}}
    <cpn1></cpn1>
    <cpn2></cpn2>
  </div>

  <script src="../js/vue.js"></script>
  <script>
    //1.创建第一个组件构造器
    const cpnC1 = Vue.extend({
      template: `
        <div>
          <h2>我是标题111111</h2>  
        </div>`
    })
    //1.1创建第二个组件构造器
    const cpnC2 = Vue.extend({
      template: `
        <div>
          <h2>我是标题222222</h2>  
        </div>`
    })

    const app = new Vue({
      el: '#app',
      data: {
        name: '余浩'
      },
      components: {
        cpn1: cpnC1,  //注册局部组件 组件名---组件构造器
        cpn2: cpnC2  
      }
    })
  </script>
</body>
</html>